package com.ruoyi.quartz.domain;

import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 每天 08:00 备份所有未读邮件，用于后续 AI 分析对象 unread_email_archive
 *
 * @author ruoyi
 * @date 2025-07-04
 */
public class UnreadEmailArchive extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 自增主键 */
    private Long id;

    /** 邮件 Message-ID */
    @Excel(name = "邮件 Message-ID")
    private String messageId;

    /** 会话线程 ID，可空 */
    @Excel(name = "会话线程 ID，可空")
    private Long threadId;

    /** 发件人邮箱 */
    @Excel(name = "发件人邮箱")
    private String fromAddress;

    /** 收件人列表，逗号分隔 */
    @Excel(name = "收件人列表，逗号分隔")
    private String toAddresses;

    /** 邮件主题 */
    @Excel(name = "邮件主题")
    private String subject;

    /** 邮件正文（纯文本或 HTML） */
    @Excel(name = "邮件正文", readConverterExp = "纯=文本或,H=TML")
    private String body;

    /** 邮件发送时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "邮件发送时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date sentTime;

    /** 拉取日期 (yyyy-MM-dd) */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "拉取日期 (yyyy-MM-dd)", width = 30, dateFormat = "yyyy-MM-dd")
    private Date fetchDate;

    /** AI 判定意向，如「有意向」「暂无意向」 */
    @Excel(name = "AI 判定意向，如「有意向」「暂无意向」")
    private String aiIntent;

    /** AI 信心度，0.0000–1.0000 */
    @Excel(name = "AI 信心度，0.0000–1.0000")
    private BigDecimal aiScore;

    /** $column.columnComment */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private Date createdAt;

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId()
    {
        return id;
    }

    public void setMessageId(String messageId)
    {
        this.messageId = messageId;
    }

    public String getMessageId()
    {
        return messageId;
    }

    public void setThreadId(Long threadId)
    {
        this.threadId = threadId;
    }

    public Long getThreadId()
    {
        return threadId;
    }

    public void setFromAddress(String fromAddress)
    {
        this.fromAddress = fromAddress;
    }

    public String getFromAddress()
    {
        return fromAddress;
    }

    public void setToAddresses(String toAddresses)
    {
        this.toAddresses = toAddresses;
    }

    public String getToAddresses()
    {
        return toAddresses;
    }

    public void setSubject(String subject)
    {
        this.subject = subject;
    }

    public String getSubject()
    {
        return subject;
    }

    public void setBody(String body)
    {
        this.body = body;
    }

    public String getBody()
    {
        return body;
    }

    public void setSentTime(Date sentTime)
    {
        this.sentTime = sentTime;
    }

    public Date getSentTime()
    {
        return sentTime;
    }

    public void setFetchDate(Date fetchDate)
    {
        this.fetchDate = fetchDate;
    }

    public Date getFetchDate()
    {
        return fetchDate;
    }

    public void setAiIntent(String aiIntent)
    {
        this.aiIntent = aiIntent;
    }

    public String getAiIntent()
    {
        return aiIntent;
    }

    public void setAiScore(BigDecimal aiScore)
    {
        this.aiScore = aiScore;
    }

    public BigDecimal getAiScore()
    {
        return aiScore;
    }

    public void setCreatedAt(Date createdAt)
    {
        this.createdAt = createdAt;
    }

    public Date getCreatedAt()
    {
        return createdAt;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("messageId", getMessageId())
                .append("threadId", getThreadId())
                .append("fromAddress", getFromAddress())
                .append("toAddresses", getToAddresses())
                .append("subject", getSubject())
                .append("body", getBody())
                .append("sentTime", getSentTime())
                .append("fetchDate", getFetchDate())
                .append("aiIntent", getAiIntent())
                .append("aiScore", getAiScore())
                .append("createdAt", getCreatedAt())
                .toString();
    }
}
